package com.lakeworks.service.impl;

import com.lakeworks.common.core.text.Convert;
import com.lakeworks.domain.OprAttachment;
import com.lakeworks.domain.vo.OprAttachmentVO;
import com.lakeworks.mapper.OprAttachmentMapper;
import com.lakeworks.service.IOprAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 入厂附件Service业务层处理
 *
 * @author lake
 * @date 2023-02-08
 */
@Service
public class OprAttachmentServiceImpl implements IOprAttachmentService {
    @Autowired
    private OprAttachmentMapper oprAttachmentMapper;

    @Override
    public OprAttachment selectByBarcode(String barcode) {
        return oprAttachmentMapper.queryByBarcode(barcode);
    }

    @Override
    public List<OprAttachment> selectByProductIdOrCompanionId(Long id) {
        return oprAttachmentMapper.queryByProductIdOrCompanionId(id);
    }

    /**
     * 查询入厂附件
     *
     * @param id 入厂附件主键
     * @return 入厂附件
     */
    @Override
    public OprAttachment selectOprAttachmentById(Long id) {
        return oprAttachmentMapper.selectOprAttachmentById(id);
    }

    /**
     * 查询入厂附件列表
     *
     * @param oprAttachment 入厂附件
     * @return 入厂附件
     */
    @Override
    public List<OprAttachment> selectOprAttachmentList(OprAttachment oprAttachment) {
        return oprAttachmentMapper.selectOprAttachmentList(oprAttachment);
    }

    /**
     * 新增入厂附件
     *
     * @param oprAttachment 入厂附件
     * @return 结果
     */
    @Override
    public int insertOprAttachment(OprAttachment oprAttachment) {
        return oprAttachmentMapper.insertOprAttachment(oprAttachment);
    }

    /**
     * 修改入厂附件
     *
     * @param oprAttachment 入厂附件
     * @return 结果
     */
    @Override
    public int updateOprAttachment(OprAttachment oprAttachment) {
        return oprAttachmentMapper.updateOprAttachment(oprAttachment);
    }

    /**
     * 批量删除入厂附件
     *
     * @param ids 需要删除的入厂附件主键
     * @return 结果
     */
    @Override
    public int deleteOprAttachmentByIds(String ids) {
        return oprAttachmentMapper.deleteOprAttachmentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除入厂附件信息
     *
     * @param id 入厂附件主键
     * @return 结果
     */
    @Override
    public int deleteOprAttachmentById(Long id) {
        return oprAttachmentMapper.deleteOprAttachmentById(id);
    }

    public List<OprAttachmentVO> listOprAttVoByProId(Long productId) {
        return oprAttachmentMapper.listOprAttVoByProId(productId);
    }

    @Override
    public Integer countOprAttVoByProId(Long productId) {
        return oprAttachmentMapper.countOprAttVoByProId(productId);
    }

    @Override
    public List<OprAttachment> listByPickupId(Long pickupId) {
        return oprAttachmentMapper.listByPickupId(pickupId);
    }
}
